package com.jfire.codejson;

import java.lang.reflect.Type;
import java.util.Date;
import com.jfire.baseutil.collection.StringCache;
import com.jfire.codejson.function.JsonReader;
import com.jfire.codejson.function.JsonWriter;

public class DateTransfer implements JsonWriter, JsonReader
{
    
    @Override
    public void write(Object target, StringCache cache)
    {
        cache.append(((Date) target).getTime());
    }
    
    @Override
    public Object read(Type entityClass, Object value)
    {
        long l = Long.valueOf((String) value);
        return new Date(l);
    }
    
}
